import { request } from 'umi';

/**
 * 查询病人分页
 */
export const patientList = (
  server: string,
  params: {
    current: number;
    size: number;
    [key: string]: any;
  },
) => {
  return request<any>(`${server}/api/patient/getPatientList`, {
    params,
    getResponse: true,
  });
};

/**
 * 查询病人
 */
export const patientSearch = (
  server: string,
  params: {
    [key: string]: any;
  },
) => {
  return request<any>(`${server}/api/patient/getPatientList`, {
    params,
    getResponse: true,
  });
};

/**
 * 添加患者
 */
export const addPatient = (server: string, patient: any) => {
  return request<any>(`${server}/api/patient/addPatient`, {
    method: 'post',
    getResponse: true,
    data: patient,
  });
};
/**
 * 修改患者
 */
export const updatePatient = (server: string, patient: any) => {
  return request<any>(`${server}/api/patient/editPatient`, {
    method: 'post',
    getResponse: true,
    data: patient,
  });
};
/**
 * 删除患者
 */
export const deletePatient = (server: string, ids: any) => {
  return request<any>(`${server}/api/patient/deletedPatient`, {
    method: 'get',
    getResponse: true,
    params: { ids },
  });
};
